package com.ww.scm.entity.pub;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonMethod;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.ww.scm.entity.AbstractEntity;

@Entity
@Table(name = "T_PUB_DIC_REF")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
// 基础数据

@JsonAutoDetect(JsonMethod.NONE)
public class DictionaryRef extends AbstractEntity {

	//类型
	private Dictionary type;
	
	private Dictionary parent;
	
	private Dictionary child; 
	
	public DictionaryRef() {
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_TYPE_ID")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Dictionary getType() {
		return type;
	}
	 
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_PARENT_ID")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getParent() {
		return parent;
	}
	  
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_CHILD_ID")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getChild() {
		return child;
	}
	 	
	public void setType(Dictionary  type) {
		this.type = type;
	}
	public void setParent(Dictionary parent) {
		this.parent = parent;
	}
	public void setChild(Dictionary child) {
		this.child = child;
	}
	
}
